﻿/*** This script will only run if the version number in the database is less than 01.80.00 ***/
if((SELECT REPLACE(VersionNumber,'.','') FROM Version) < '019000')
BEGIN

	/** Update Version **/
	DELETE FROM Version
	INSERT INTO Version(VersionNumber) VALUES (N'01.90.00')
	
	/****** Object:  Table [dbo].[SilverlightNotepad]  ******/
	IF NOT EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[SilverlightNotepad]') AND OBJECTPROPERTY(id, N'IsUserTable') = 1)
	BEGIN
	CREATE TABLE [dbo].[SilverlightNotepad](
	[NoteID] [int] IDENTITY(1,1) NOT NULL,
	[UserName] [nvarchar](50) NOT NULL,
	[IPAddress] [nvarchar](50) NOT NULL,
	[Note] [nvarchar](100) NULL,
	CONSTRAINT [PK_SilverlightNotepad] PRIMARY KEY CLUSTERED 
	(
	[NoteID] ASC
	)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, 
	ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
	) ON [PRIMARY]
	END

	DELETE FROM SilverlightDesktopModules WHERE (ModuleName = N'Silverlight Notepad')
	INSERT INTO SilverlightDesktopModules (ModuleName, ModuleDescription, AssemblyName, ClassName, IconName, [Role], WindowSize, AllowMultipleInstances, ModuleVersion, uninstall)
	VALUES(N'Silverlight Notepad', N'Allows users to save notes', N'SilverlightNotepad.xap', N'SilverlightNotepad.Page', 'null', N'Any', N'50', N'True', 300000, N'DROP TABLE [dbo].[SilverlightNotepad] END')

END


